﻿<%@ Page Language="C#" MasterPageFile="~/Master/Manager.master" AutoEventWireup="true"
    CodeBehind="Index.aspx.cs" Inherits="SH.LMS.Web.UI.Manager.Index" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script type="text/javascript">


        jQuery(document).ready(function () {

//            var source = {
//                "colModelList":
//                [
//                    { "index": "id", "label": "CM", "name": "id", "width": 100 },
//                    { "index": "title", "label": "CM + 1", "name": "title", "width": 100 },
//                    { "index": "content", "label": "CM + 2", "name": "content", "width": 100 }
//                ],
//                "columnNames":
//                [
//                    "id", "title", "content"
//                ]
//                //                ,
//                //                "couponStripList": {
//                //                    "rootVar": [
//                //                        { "id": 71, "coupon": 5.0, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" },
//                //                        { "id": 72, "coupon": 5.5, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" },
//                //                        { "id": 73, "coupon": 6.0, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" },
//                //                        { "id": 74, "coupon": 6.5, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" },
//                //                        { "id": 75, "coupon": 7.0, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" }
//                //                    ]
//                //                },
//                //                "deliveredDataTimestamp": null,
//                //                "requestedTimestamp": null
//            }

//            $.ajax({
//                type: "Get",
//                url: '/Handler/Common.ashx',
//                async: false,
//                data: {
//                    method: 'getdata',
//                    args: {

//                    },
//                    returnType: 'json'
//                },
//                success: function (result) {
//                    //            var colD = source.couponStripList,
//                    var colD = $.parseJSON(result);
//                    colM = source.colModelList;

//                    $("#list2").jqGrid({
//                        datatype: 'local',
//                        data: colD,
//                        gridview: true,
//                        colModel: colM,
//                        height: "auto",
//                        loadonce: true,
//                        pager: $('#pager2'),
////                        rowNum: 1,
////                        rowList: [5, 10, 20, 50],
//                        loadComplete: function (data) {
//                            alert('loaded');
//                        },
//                        loadError: function (xhr, status, error) {
//                            alert('error');
//                        }
//                    });
//                },
//                error: function (xhr, status, e) {
//                    //에러 발생시 처리함수
//                    uCTMS.Msg(xhr.responseText);
//                }
//            });















                        jQuery("#list2").jqGrid({
                            // the url parameter tells from where to get the data from server
                            // adding ?nd='+new Date().getTime() prevent IE caching
                            url: 'example.php?nd=' + new Date().getTime(),
                            // datatype parameter defines the format of data returned from the server
                            // in this case we use a JSON data
                            datatype: "json",
                            // colNames parameter is a array in which we describe the names
                            // in the columns. This is the text that apper in the head of the grid.
                            colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
                            // colModel array describes the model of the column.
                            // name is the name of the column,
                            // index is the name passed to the server to sort data
                            // note that we can pass here nubers too.
                            // width is the width of the column
                            // align is the align of the column (default is left)
                            // sortable defines if this column can be sorted (default true)
                            colModel: [
                    { name: 'id', index: 'id', width: 55 },
                    { name: 'invdate', index: 'invdate', width: 90 },
                	{ name: 'name', index: 'name asc, invdate', width: 100 },
                    { name: 'amount', index: 'amount', width: 80, align: "right" },
                    { name: 'tax', index: 'tax', width: 80, align: "right" },
                    { name: 'total', index: 'total', width: 80, align: "right" },
                    { name: 'note', index: 'note', width: 150, sortable: false }
                ],
                            // pager parameter define that we want to use a pager bar
                            // in this case this must be a valid html element.
                            // note that the pager can have a position where you want
                            pager: jQuery('#pager2'),
                            // rowNum parameter describes how many records we want to
                            // view in the grid. We use this in example.php to return
                            // the needed data.
                            rowNum: 10,
                            // rowList parameter construct a select box element in the pager
                            //in wich we can change the number of the visible rows
                            rowList: [10, 20, 30],
                            // path to mage location needed for the grid
                            imgpath: 'themes/sand/images',
                            // sortname sets the initial sorting column. Can be a name or number.
                            // this parameter is added to the url
                            sortname: 'id',
                            //viewrecords defines the view the total records from the query in the pager
                            //bar. The related tag is: records in xml or json definitions.
                            viewrecords: true,
                            //sets the sorting order. Default is asc. This parameter is added to the url
                            sortorder: "desc",
                            caption: "Demo"
                        });
        });
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        ASP.NET 시작
    </h2>
    <!-- the grid definition in html is a table tag with class 'scroll' -->
        <table id="list2" class="scroll" cellpadding="0" cellspacing="0">
        </table>
        <!-- pager definition. class scroll tels that we want to use the same theme as grid -->
        <div id="pager2">
        </div>
    <p>
        <a href="http://go.microsoft.com/fwlink/?LinkID=152368" title="MSDN ASP.NET 문서">MSDN에서
            ASP.NET 설명서</a>를 확인할 수도 있습니다.
    </p>
</asp:Content>
